****
** Replication File:
**
** "The Impact of Social Desirability Bias on Conspiracy
** Belief Measurement Across Cultures"
**
** Steven M. Smallpage, Adam M. Enders, Hugo Drochon, and Joseph E. Uscinski
**
** Analyses conducted in Stata/SE 15.1
****

set more off

* Set working directory

* Open Stata dataset
use "SDB Data.dta"

********************************************************************************

****
** Figure 2 (stored in "Proportions by CT.csv")
****

mean elitecontrol if country == 1
mean elitecontrol if country == 2
mean elitecontrol if country == 3
mean elitecontrol if country == 4
mean elitecontrol if country == 5
mean elitecontrol if country == 6
mean elitecontrol if country == 7

mean secretplots if country == 1
mean secretplots if country == 2
mean secretplots if country == 3
mean secretplots if country == 4
mean secretplots if country == 5
mean secretplots if country == 6
mean secretplots if country == 7

mean aliencontact if country == 1
mean aliencontact if country == 2
mean aliencontact if country == 3
mean aliencontact if country == 4
mean aliencontact if country == 5
mean aliencontact if country == 6
mean aliencontact if country == 7

mean aidsvirus if country == 1
mean aidsvirus if country == 2
mean aidsvirus if country == 3
mean aidsvirus if country == 4
mean aidsvirus if country == 5
mean aidsvirus if country == 6
mean aidsvirus if country == 7

mean controlworldevents if country == 1
mean controlworldevents if country == 2
mean controlworldevents if country == 3
mean controlworldevents if country == 4
mean controlworldevents if country == 5
mean controlworldevents if country == 6
mean controlworldevents if country == 7

mean holocaustdeny if country == 1
mean holocaustdeny if country == 3
mean holocaustdeny if country == 4
mean holocaustdeny if country == 5
mean holocaustdeny if country == 6
mean holocaustdeny if country == 7

mean globalwarminghoax if country == 1
mean globalwarminghoax if country == 2
mean globalwarminghoax if country == 3
mean globalwarminghoax if country == 4
mean globalwarminghoax if country == 5
mean globalwarminghoax if country == 6
mean globalwarminghoax if country == 7

mean govthideimmigrants if country == 1
mean govthideimmigrants if country == 2
mean govthideimmigrants if country == 3
mean govthideimmigrants if country == 4
mean govthideimmigrants if country == 5
mean govthideimmigrants if country == 6
mean govthideimmigrants if country == 7

****
** Figure 3, with Bonferonni corrections to p-values
** (stored in "Counts by Condition.csv")
****

ttest ctcount if country==1, by(treat) unequal
di r(p)*7

ttest ctcount if country==2, by(treat) unequal
di r(p)*7

ttest ctcount if country==3, by(treat) unequal
di r(p)*7

ttest ctcount if country==4, by(treat) unequal
di r(p)*7

ttest ctcount if country==5, by(treat) unequal
di r(p)*7

ttest ctcount if country==6, by(treat) unequal
di r(p)*7

ttest ctcount if country==7, by(treat) unequal
di r(p)*7

ttest ctcount, by(treat) unequal
di r(p)*7

****
** Cohen's d (pages 13–14 of draft)
****

bootstrap r(d), reps(200) nowarn seed(1234): ///
esize twosample ctcount, by(treat) all

bootstrap r(d), reps(200) nowarn seed(1234): ///
esize twosample ctcount if country==1, by(treat) all

bootstrap r(d), reps(200) nowarn seed(1234): ///
esize twosample ctcount if country==2, by(treat) all

bootstrap r(d), reps(200) nowarn seed(1234): ///
esize twosample ctcount if country==3, by(treat) all

bootstrap r(d), reps(200) nowarn seed(1234): ///
esize twosample ctcount if country==4, by(treat) all

bootstrap r(d), reps(200) nowarn seed(1234): ///
esize twosample ctcount if country==5, by(treat) all

bootstrap r(d), reps(200) nowarn seed(1234): ///
esize twosample ctcount if country==6, by(treat) all

bootstrap r(d), reps(200) nowarn seed(1234): ///
esize twosample ctcount if country==7, by(treat) all

****
** Table 1
****

* Country models
reg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry ///
	if country == 1
est store mod1

reg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry ///
	if country == 2
est store mod2

reg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry ///
	if country == 3
est store mod3

reg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry ///
	if country == 4
est store mod4

reg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry ///
	if country == 5
est store mod5

reg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry ///
	if country == 6
est store mod6

reg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry ///
	if country == 7
est store mod7
	
* Pooled model
xtset country	
	
xtreg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry, fe
est sto mod8		

* Save model estimates
esttab mod1 mod2 mod3 mod4 mod5 mod6 mod7 mod8 using "Table1.rtf", ///
	cells(b(star fmt(3)) se(par fmt(3))) legend label ///
	varlabels(_cons Constant) stats(r2 N, fmt(3 0 1)) ///
	addnotes(Note: OLS coefficients with standard errors in parentheses)
	
****
** Table A1
****	

bysort country: sum trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender

****
** Table A2
****

bysort treat: sum trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender

****
** Table A3
****	

xtreg ctcount treat if country!=2, fe
est sto mod10
	
xtreg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry if country!=2, fe
est sto mod11		

esttab mod10 mod11 using "TableA3.rtf", ///
	cells(b(star fmt(3)) se(par fmt(3))) legend label ///
	varlabels(_cons Constant) stats(r2 N, fmt(3 0 1)) ///
	addnotes(Note: OLS coefficients with standard errors in parentheses)
	
****
** Table A4
****

reg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry ///
	i.country, noconstant
est sto mod12	

* R-squared info for table
xtreg ctcount treat trustjournalists trustownofficials privatetrust ideology ///
	divinedecision edu unemployed age gender democraticcountry, fe

esttab mod12 using "TableA4.rtf", ///
	cells(b(star fmt(3)) se(par fmt(3))) legend label ///
	varlabels(_cons Constant) stats(r2 N, fmt(3 0 1)) ///
	addnotes(Note: OLS coefficients with standard errors in parentheses)

****
** Table A5 and interaction information 
** (page 15 of draft)
****

xtreg ctcount c.treat##c.trustjournalists c.treat##c.trustownofficials ///
	c.treat##c.privatetrust c.treat##c.ideology c.treat##c.divinedecision ///
	c.treat##c.edu c.treat##c.unemployed c.treat##c.age c.treat##c.gender ///
	c.treat##c.democraticcountry, fe
est store mod9
margins, dydx(treat) at(divinedecision=(0(1)3))
	
esttab mod9 using "TableA5.rtf", ///
	cells(b(star fmt(3)) se(par fmt(3))) legend label ///
	varlabels(_cons Constant) stats(r2 N, fmt(3 0 1)) ///
	addnotes(Note: OLS coefficients with standard errors in parentheses)	
